All Packages Class Hierarchy This Package Previous Next Index
Class sun.server.util.DiskCacheImpl
java.lang.Object
|
+----sun.server.util.DiskCacheImpl
- public class DiskCacheImpl
- extends Object
- implements DiskCache
-
DiskCacheImpl(String, int, CacheReplacer, int, int)
-
-
dropReadLock(URLContents)
-
-
entries()
- This returns an enumeration of cache entries in the cache i.e an
enumeration of CacheEntry objects.
-
getReadLockedContents(URL, FetchContents)
- This reads the cache entry for the URL.
-
remove(URL)
- This method removes the url and its associated contents from the cache.
-
setMaxDiskCacheEntrySize(int)
-
-
setMaxRamCacheEntrySize(int)
-
-
setPath(String)
- Set the path to the disk cache
-
setReplacementPolicy(CacheReplacer)
- When files are to be replaced, the CacheReplacer chooses which enties
must go.
-
setSize(int)
- Set the size of the disk cache.
DiskCacheImpl
public DiskCacheImpl(String path,
int size,
CacheReplacer cr,
int maxRamCacheEntrySize,
int maxDiskCacheEntrySize)
setPath
public void setPath(String fullPathName)
- Set the path to the disk cache
- Parameters:
- fullPathName - the path to the place where the files are stored
setSize
public void setSize(int sizeInBytes)
- Set the size of the disk cache.
- Parameters:
- sizeInBytes - the total size of the disk cache in bytes.
setReplacementPolicy
public void setReplacementPolicy(CacheReplacer cr)
- When files are to be replaced, the CacheReplacer chooses which enties
must go.
- Parameters:
- cr - the CacheReplacer object that dictates replacement policy.
setMaxRamCacheEntrySize
public void setMaxRamCacheEntrySize(int maxEntrySize)
setMaxDiskCacheEntrySize
public void setMaxDiskCacheEntrySize(int maxEntrySize)
getReadLockedContents
public URLContents getReadLockedContents(URL url,
FetchContents fc) throws IOException
- This reads the cache entry for the URL. If the URL is cached, the
contents of the cache is returned. Otherwise, the get method of the
FetchContents interface is called to retrieve the contents in an
application specific way. The contents returned by FetchContents are
cached, and a copy is returned to the application.
- Parameters:
- url - - the url that must be read.
- fc - - the FetchContents interface that must be implemented by the
application. The get() method of the FetchContents interface
is called when there is a cache miss.
- Returns:
- URLContentsImpl - the contents of the URL, either read from the cache
or by calling FetchContents.
- Throws: IOException
- - an IOException occured while reading the URL
contents.
dropReadLock
public void dropReadLock(URLContents uc)
remove
public void remove(URL url)
- This method removes the url and its associated contents from the cache.
- Parameters:
- url - - this is the URL that has to be flushed from the cache.
entries
public URLContents[] entries()
- This returns an enumeration of cache entries in the cache i.e an
enumeration of CacheEntry objects.
This is a dirty read and represents a snapshot of the cache as
it was when the call was made. This information can
only used for reading the meta information and deciding which entries
to replace. It is typically used by the CacheReplacer object.
- Returns:
- the list of CacheEntry in this cache.
All Packages Class Hierarchy This Package Previous Next Index